package com.kxxnzstdsw.router

import com.kxxnzstdsw.modle.dto.LoginParams
import com.kxxnzstdsw.plugins.success
import com.kxxnzstdsw.service.AccountService
import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.routing.*
import org.koin.ktor.ext.inject

fun Route.account() {
  val accountService by inject<AccountService>()
  route("/account") {
    post("/login") {
      val params = call.receive<LoginParams>()
      val token = accountService.login(params)
      call.success(token)
    }
  }
}
